/* eslint-disable no-unneeded-ternary */
/* eslint-disable import/no-dynamic-require */
import React, { FC } from 'react';
import { history } from 'umi';
import style from './index.less';

export interface NavProps {
  homeStatue: boolean;
  mineStatus: boolean;
}

const Nav: FC<NavProps> = (props) => {
  const { homeStatue, mineStatus } = props;

  const changeRuter = (type: Number) => {
    if (type === 0) {
      history.push('/home');
    } else {
      history.push('/mine');
    }
  };

  return (
    <div className={style.navWraper}>
      <div
        className={`${style.navItem}  ${homeStatue ? style.active : ''}`}
        onClick={() => changeRuter(0)}
      >
        <i className={style.home} />
        <p>首页</p>
      </div>
      <div
        className={`${style.navItem}  ${mineStatus ? style.active : ''}`}
        onClick={() => changeRuter(1)}
      >
        <i className={style.mine} />
        <p>我的</p>
      </div>
    </div>
  );
};

export default Nav;
